#coding=utf-8


#建立容器
import tkinter as tk
from tkinter import ttk
from tkinter.filedialog import *
import tkinter.messagebox
tk=Tk()
tk.title("个人GUI界面学习")
mainfarm=Frame(tk,width=800, height=100,bg="black")
mainfarm.grid_propagate(0)
mainfarm.grid()
fram=Frame(mainfarm,width=400, height=100,bg="black")
fram.grid_propagate(0)
fram.grid()


e = Entry(fram)
e.grid(row=0,column=2)

e.delete(0, END)  # 将输入框里面的内容清空
e.insert(0, '选择人像图片')
filepath=StringVar()
def filefound():
    filepath= askopenfilename()
    print (filepath)
    e.delete(0, END)  # 将输入框里面的内容清空
    e.insert(0, filepath)

#button1=Button(fram,text="button1").grid(row=0,column=1)
button2=Button(fram,text="选择文件",command=filefound).grid(row=0,column=3)
#print (fram.size())

mainloop()
